﻿using System;
using System.Runtime.InteropServices;
using System.Windows.Media;

namespace BssDs.Client.UI.Screens.Core.Windows
{
    public class Win32dll
    {
        [DllImport("user32.dll", CallingConvention = CallingConvention.StdCall)]
        private static extern void GetCursorPos(out Win32dll.Point pt);

        public struct Point
        {
            public UInt32 X;
            public UInt32 Y;
        }

        public static System.Windows.Point GetCursorPos(Visual visual)
        {
            Win32dll.Point p;
            GetCursorPos(out p);
            return visual.PointFromScreen(new System.Windows.Point(p.X, p.Y));
        }
    }
}
